#!/usr/bin/env python3
# usage: toot.py domain.name email .client .user image.png

import sys
from mastodon import Mastodon

mastodon = Mastodon(
    client_id = sys.argv[2],
    access_token = sys.argv[3],
    api_base_url = 'https://' + sys.argv[1]
)

pic = mastodon.media_post(sys.argv[4], description='a small automatically-generated black and white image')
mastodon.status_post(sys.argv[5], visibility="public", media_ids=[pic])
